﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_GetTop5DayTaskDetailList]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_GetTop5DayTaskDetailList];
GO
CREATE PROCEDURE [dbo].[sproc_GetTop5DayTaskDetailList]
    @Date datetime,
             @Username nvarchar(20)

As

 Select  distinct  top 5 *
    FROM UDS_Schedule
    WHERE Username=@Username and [date]=@Date and PeriodID!=0 order by TaskID desc